//
//  TabBarController.m
//  07-HomeWork
//
//  Created by dllo on 16/7/22.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "TabBarController.h"
#import "FirstPageViewController.h"
#import "NewsViewController.h"
#import "FindViewController.h"
#import "MyViewController.h"

@interface TabBarController ()

@end

@implementation TabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createNavigation];


}
#pragma mark - 创建每个TabBarItem对应的视图控制器
- (void)createNavigation {
    // 创建四个界面VC
    FirstPageViewController *firstPageVC = [[FirstPageViewController alloc] init];
    NewsViewController *newsVc = [[NewsViewController alloc] init];
    FindViewController *findVC = [[FindViewController alloc] init];
    MyViewController *myVC = [[MyViewController alloc] init];
    // 创建消息界面的NavigationController
    UINavigationController *newsNavi = [[UINavigationController alloc] initWithRootViewController:newsVc];
    // 将VC和Navi添加到标签视图中
    self.viewControllers = @[firstPageVC, newsNavi, findVC, myVC];
    firstPageVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed:@"0"] tag:100];
    newsNavi.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"消息" image:[UIImage imageNamed:@"1"] tag:100];
    findVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"发现" image:[UIImage imageNamed:@"2"] tag:100];
    myVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我" image:[UIImage imageNamed:@"3"] tag:100];
   

    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
